package com.neu.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.neu.R;
import com.neu.adapter.LsAdapter;

public class LsActivity extends AppCompatActivity {

    private ListView lv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ls);

        lv=findViewById(R.id.lv);

        //数据源
        final String[] objects = new String[]{
                "zhangsan", "lisi", "wanger",
                "a", "b", "c",
                "zhangsan", "lisi", "wanger",
                "zhangsan", "lisi", "wanger",
        };

        LsAdapter adapter=new LsAdapter(objects,this);
        //添加adapter
        lv.setAdapter(adapter);
//        //视图
//
//        //适配器
//        ArrayAdapter<String> adapter=new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,objects);
//        lv.setAdapter(adapter);
//
//        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//            @Override
//            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//                Log.d("TAG", "onItemClick: "+position);
//            }
//        });

        //列表的数据源

    }
}